package com.example.makerspace.controller.project;

import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.project.ProjectDTO;
import com.example.makerspace.dto.project.ProjectTypeBaseDTO;
import com.example.makerspace.service.ProjectService;
import com.example.makerspace.service.ProjectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/api/project")
public class ProjectController {

    @Autowired
    private ProjectService projectService;

    @PostMapping("/create")
    public Result create(@RequestBody ProjectDTO projectDTO) {
        return projectService.create(projectDTO);
    }

    @PostMapping("/query")
    public Result query(@RequestBody ProjectDTO projectDTO){
        return projectService.query(projectDTO);
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody ProjectDTO projectDTO){
        return projectService.delete(projectDTO.getId());
    }

    @PostMapping("/update")
    public Result update(@RequestBody ProjectDTO projectDTO){
        return projectService.update(projectDTO);
    }
}
